package cn.flightcloud.boot.common.json.serialize;

import java.io.IOException;

import org.springframework.boot.jackson.JsonComponent;
import org.springframework.boot.jackson.JsonObjectSerializer;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;

import cn.flightcloud.boot.user.entity.User;

@JsonComponent
public class UserSerialize extends JsonObjectSerializer<User>{
	
	
	public UserSerialize(){
		System.out.println("serialize init");
	}

	@Override
	protected void serializeObject(User user, JsonGenerator jgen, SerializerProvider provider) throws IOException {
		jgen.writeObjectField("name1", user.getName());
	}


}
